package com.zxx.pattern.mediatorPattern.mediator2;

/**
 * @author zxx on 2021/5/11
 */
public class TestMediator2 {

    public static void main(String[] args) {
        //一个房主、一个租房者、一个中介机构
        MediatorStructure structure = new MediatorStructure();

        //房主和租房者只需要知道中介机构即可
        HouseOwner houseOwner = new HouseOwner("杂行", structure);
        Tenant tenant = new Tenant("李四", structure);

        //中介结构要知道房主和租房者
        structure.setHouseOwner(houseOwner);
        structure.setTenant(tenant);

        tenant.constact("听说你那里有三室的房主出租.....");
        houseOwner.constact("是的!请问你需要租吗?");
    }

}
